
package cn.nubia.admin.sysconfig.bean;


import cn.nubia.admin.common.mybatis.annotations.Column;
import cn.nubia.admin.common.mybatis.annotations.Id;
import cn.nubia.admin.common.mybatis.annotations.Table;
import cn.nubia.admin.common.mybatis.annotations.UnColumn;
import org.hibernate.validator.constraints.NotBlank;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.List;

/**
 CREATE TABLE `nb_category` (
 `category_id` int(11) NOT NULL AUTO_INCREMENT COMMENT '分类id',
 `category_name` varchar(50) DEFAULT NULL COMMENT '分类名称',
 `category_value` varchar(50) DEFAULT NULL COMMENT '分类标识',
 `parent_id` int(11) DEFAULT NULL COMMENT '父类id',
 `sort_index` int(11) DEFAULT NULL COMMENT '排序号',
 `state` smallint(6) DEFAULT NULL COMMENT '状态（-1-删除  0-隐藏 1-显示）',
 `summary` varchar(200) DEFAULT NULL COMMENT '简介',
 `icon_url` varchar(200) DEFAULT NULL COMMENT '图标',
 `modify_enable` tinyint(4) DEFAULT NULL COMMENT '是否允许修改',  -IG
 `old_category_id` int(11) DEFAULT NULL COMMENT '旧系统的分类id',  -IG
 `level_path` varchar(50) DEFAULT NULL COMMENT '层级路径',  -IG
 `level` tinyint(4) NOT NULL DEFAULT '1' COMMENT '层级',
 PRIMARY KEY (`category_id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分类';
 */
@Table(value = "nb_category")
public class Category implements Serializable{

    private static final long serialVersionUID = -8244661101951482489L;

    public static final String COLUMN_ID ="id";

    public static final String COLUMN_CATEGORY_NAME = "categoryName";

    @Id(value = "category_id")
    private Integer id;
    @Column(value = "category_name")
    @NotBlank(message = "分类名不能为空")
    @Size(max=50,message = "名字不能超过50字")
    private String categoryName;//分类名称
    @NotBlank(message = "分类值不能为空")
    @Size(max=50,message = "分类值不能超过50字")
    @Column(value = "category_value")
    private String categoryValue;//分类标识
    @Column(value = "parent_id")
    private Integer parentId;//父类id
    @NotNull(message = "排序号不能为空")
    @Column(value = "sort_index")
    private Integer sortIndex;//排序号
    @Column(value = "state")
    private Integer state;//状态（-1-删除  0-隐藏 1-显示）
    @Column(value = "level")
    private Integer level;//等级（1,2,3）
    @Column(value = "summary")
    @Size(max=200,message = "简介不能超过200字")
    private String summary;//简介
//    @NotBlank(message = "图标不能为空")
    @Size(max=200,message = "不能超过200长度")
    @Column(value = "icon_url")
    private String iconUrl;//图标
    @UnColumn
    private  int hasSub=0;
    @UnColumn
    private List<Category> subCategoryList;

    private Integer isRec;

    public static final Integer STATE_DELETE=-1;
    public static final Integer STATE_HIDDEN=0;
    public static final Integer STATE_SHOW=1;
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getCategoryName() {
        return categoryName;
    }

    public void setCategoryName(String categoryName) {
        this.categoryName = categoryName;
    }

    public String getCategoryValue() {
        return categoryValue;
    }

    public void setCategoryValue(String categoryValue) {
        this.categoryValue = categoryValue;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Integer getSortIndex() {
        return sortIndex;
    }

    public void setSortIndex(Integer sortIndex) {
        this.sortIndex = sortIndex;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary = summary;
    }

    public String getIconUrl() {
        return iconUrl;
    }

    public void setIconUrl(String iconUrl) {
        this.iconUrl = iconUrl;
    }

    public List<Category> getSubCategoryList() {
        return subCategoryList;
    }

    public void setSubCategoryList(List<Category> subCategoryList) {
        this.subCategoryList = subCategoryList;
    }

    @Override
    public String toString() {
        return "Category{" +
                "id=" + id +
                ", categoryName='" + categoryName + '\'' +
                ", categoryValue='" + categoryValue + '\'' +
                ", parentId=" + parentId +
                ", sortIndex=" + sortIndex +
                ", state=" + state +
                ", level=" + level +
                ", summary='" + summary + '\'' +
                ", iconUrl='" + iconUrl + '\'' +
                '}';
    }

    public int getHasSub() {
        return hasSub;
    }

    public void setHasSub(int hasSub) {
        this.hasSub = hasSub;
    }

    public Integer getLevel() {
        return level;
    }

    public void setLevel(Integer level) {
        this.level = level;
    }

    public Integer getIsRec() {
        return isRec;
    }

    public void setIsRec(Integer isRec) {
        this.isRec = isRec;
    }
}
